package demo02;

import javax.xml.bind.annotation.XmlType;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author JYH
 * @version 1.0
 * @date 2022/10/26 16:14
 */
public class Test02 {
    public static void main(String[] args) {
        Mouse m1 = new Mouse();
        m1.use(4);
    }
}
@Retention(RetentionPolicy.RUNTIME)
@Target(value = {ElementType.LOCAL_VARIABLE,ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER,ElementType.CONSTRUCTOR})
@interface MyAnno{
}

class Mouse{
    @MyAnno
    private int size;
    @MyAnno
    public void use(@MyAnno int size){
        @MyAnno
        int c=1;
        System.out.println("鼠标的尺寸是"+size);
    }
    @MyAnno
    public Mouse() {
    }
}